package org.replay.config;

import org.replay.service.SeckillService;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.RequestMapping;

/*
 * Copyright © 2020 lizicong,All rights reserved.
 *
 * Licensed under the GPL License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * 服务熔断
 * 提供服务的节点难免会因为网络波动,或者宕机而停止服务,但不能让其影响请求处理链路,所以应该在API察觉到某节点失效时,返回默认值.
 * @author lizicong
 */
@Configuration
@RequestMapping("/abcabc")//防止用户在降级返回页面F5造成请求重复
public class ApiFallbackConfiguration implements SeckillService {
    @Override
    public String getStock() {
        return "getStock error";
    }

    @Override
    public String seckillBuy(Integer userID, Integer commodityID) {
        return "seckillBuy error";
    }

    @Override
    public void nodePreheat(String code) {
        return;
    }
}
